import axios from "axios";
import nprogress from 'nprogress'
// 引入进度条样式
import 'nprogress/nprogress.css'
const requestsMock = axios.create({
  baseURL:'/mock',
  timeout:6000
})
requestsMock.interceptors.request.use((config)=>{
  nprogress.start()
  return config
})
requestsMock.interceptors.response.use((res)=>{
    nprogress.done()
    return res.data
  },(err)=>{
    return Promise.reject(new Error(err || '失败了！'))
  }
)
export default requestsMock